package com.bfly.mall.product.dto;

import com.bfly.core.config.ResourceConfigure;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.util.List;

/**
 * 产品类目
 *
 * @author 长沙商脉科技有限公司
 * @date 2020/9/15 20:48
 */
public class ProductCategoryListDTO implements Serializable,Comparable<ProductCategoryListDTO> {

    private static final long serialVersionUID = -7148868363502483456L;
    private int id;
    private String name;
    private List<ProductCategoryListDTO> children;
    private String pic;
    private int seq;

    @Override
    public int compareTo(ProductCategoryListDTO o) {
        return this.getSeq()-o.getSeq();
    }

    public String getUrl() {
        return StringUtils.isNotBlank(getPic()) ? ResourceConfigure.getResourceHttpUrl(getPic()) : "";
    }

    public int getSeq() {
        return seq;
    }

    public void setSeq(int seq) {
        this.seq = seq;
    }

    public String getPic() {
        return pic;
    }

    public void setPic(String pic) {
        this.pic = pic;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<ProductCategoryListDTO> getChildren() {
        return children;
    }

    public void setChildren(List<ProductCategoryListDTO> children) {
        this.children = children;
    }
}
